package com.ku.pksu.bornegaarden.lp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.ku.pksu.bornegaarden.R;

public class Vi extends Activity implements OnClickListener {

	private LinearLayout summary_button;
	private TextView summary, title;
	private boolean expanded = false;
	private Laereplan.Lps lp;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.vi);

		Intent i = getIntent();
		
		if (i != null){
			Bundle b = i.getExtras();
			lp = (Laereplan.Lps)b.get("lp");
		}
		
		title = (TextView)findViewById(R.id.lp_title);
		title.setText(Laereplan.e2s(lp));
		summary_button = (LinearLayout)findViewById(R.id.lp_summary_parent);
		summary = (TextView)findViewById(R.id.lp_summary);

		summary_button.setOnClickListener(this);
		
		switch(lp){
		case JEG:
			summary.setText(getString(R.string.jeg_bullets));
			break;
		case VI:
			summary.setText(getString(R.string.vi_bullets));
			break;
		case BEVAEGELSE:
			summary.setText(getString(R.string.bevaegelse_bullets));
			break;
		case NATUR:
			summary.setText(getString(R.string.natur_bullets));
			break;
		case SPROG:
			summary.setText(getString(R.string.sprog_bullets));
			break;
		case KULTUR:
			summary.setText(getString(R.string.kultur_bullets));
			break;
		}

	}

	@Override
	public void onClick(View v) {
		switch(v.getId()){
		case R.id.lp_summary_parent:
			if (!expanded){
				summary.setMaxLines(100);
			} else {
				summary.setMaxLines(4);
			}
			expanded = !expanded;
			break;
		}
	}

}
